# syntax=docker/dockerfile:1

FROM python:3.13-slim

# Install system packages needed for archive extraction and some libs
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      p7zip-full \
      unar \
      ca-certificates \
      libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    LANG=C.UTF-8 \
    LC_ALL=C.UTF-8 \
    PORT=5000

WORKDIR /app

# Copy dependency list and install
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . ./

# Expose HTTP service port
EXPOSE 5000

# Use gunicorn over HTTP, bind to container network
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:5000", "web_app:app"]